/*
                    Scrollbar Class Definition
*/

#ifndef VSCROLLBAR_H
#define VSCROLLBAR_H

#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_rotozoom.h"
#include <string>
#include <iostream>
#include <sstream>

#include "Button.h"

#include "Widget.h"

using namespace std;

class VScrollbar : public Widget
{
      public:
             VScrollbar();
             ~VScrollbar();

             int Initialise(Point NewPosition, string strUFilepath, string strDFilepath,
                                   string strBFilepath, string strSFilepath, int iNewHeight,
                                          int iNewNotches);

             int CalculateScrollbar();
             int UpdateScroller();

             int BlitToSurface(SDL_Surface *screen);

             int BlitToFrame(SDL_Surface *surface, Point FramePosition);

             int HandleMouseDown(int iMouseX, int iMouseY);
             int HandleMouseUp(int iMouseX, int iMouseY);
             int HandleMouseMotion(int iMouseXREL, int iMouseYREL);

             void setHeight(int iNewHeight);
             int getHeight();

             int getWidth();

             void setNotches(int iNewNotches);
             int getNotches();

             void setPosition(Point NewPosition);
             Point getPosition();

             void setScrollEnabled(bool bNewScrollEnabled);

             int getCurNotch();
             void setCurNotch(const int& iNewNotch);

             void AddNotch();
             void RemoveNotch();
             void ScrollToBottom();

             int MoveRelative(double x, double y);
      protected:
                Button buttonUp;
                Button buttonDown;

                double curDist;

                string strBackgroundPath;

                SDL_Surface *Image, *Scroller, *temp;

                Point Position, ScrollerPosition;
                int iHeight, iWidth;

                int iClickY;

                bool bScrolling, bHeightChanged, bScrollEnabled;

                int iScrollStartHeight;
                int iScrollEndHeight;
                double dNotchScrollDistance;
                double dCurScrollDistance;
                int iTotalScrollDistance;
                int iNotches, iCurNotch;
                int iClickNotches;
};

#endif
